<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>用户信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8" />
    <link rel="stylesheet" href="${ctx}/css/font.css">
    <link rel="stylesheet" href="${ctx}/css/xadmin.css">
    <script type="text/javascript" src="${ctx}/js/jquery.min.js"></script>
    <script type="text/javascript" src="${ctx}/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${ctx}/js/xadmin.js"></script>
    <script type="text/javascript">
      $(function(){
        var n1 ="1"; // 教师
        var n2 ="2"; // 学生
        var n3 ="3"; // 管理员
        var n = "${sessionScope.user_session.userType}";

        if(n2==n||n1==n) {
          $("#up").css("display", "none");
          $("#do").css("display", "none");
          $('tr').find('td:eq(4)').hide();
        }
      })
    </script>
  </head>
  
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a>
          <cite>二级指标</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="${ctx}/target/two" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row" style="" align="center">
        <form class="layui-form layui-col-md12 x-so" method="get" action="${ctx}/target/two">
          <input type="text" name="content" style="width:50%;"  placeholder="请输入查找内容" autocomplete="off" class="layui-input">
          <button class="layui-btn"><i class="layui-icon">&#xe615;</i></button>
        </form>
        <form class="layui-form layui-col-md12 x-so" method="get" action="${ctx}/target/two/add">
          <button id="up" class="layui-btn layui-btn-small" style="margin-left:900px;margin-top: -100px;">添加</button>
        </form>
      </div>
      <table class="layui-table">
        <thead>
        <tr>
          <th>一级指标名称</th>
          <th>二级指标名称</th>
          <th>二级指标权重</th>
          <th>二级指标分数</th>
          <th id="do">操作</th>
        </thead>
        <tbody>
        <c:forEach items="${requestScope.list}" var="list" varStatus="stat">
          <tr>
            <td>${list.target.name}</td>
            <td>${list.name}</td>
            <td>${list.weight}</td>
            <td>${list.score}</td>
            <td class="td-manage">
              <a title="编辑"  href='${ctx}/target/twoedit?id=${list.id}'>
                <i class="layui-icon">&#xe642;</i>
              </a>
              <a title="删除" onclick="member_del(this,'${list.id }')" href="javascript:;">
                <i class="layui-icon">&#xe640;</i>
              </a>
            </td>
          </tr>
        </c:forEach>
        </tbody>
      </table>
    </div>
    <script type="text/javascript">

      /*用户-删除*/
      function member_del(obj,id){
          layer.confirm('确认要删除吗？',function(index){
              //发异步删除数据
              //等以后再使用异步，这里先使用
              $.get("${ctx}/deltwotarget?id="+id);
              $(obj).parents("tr").remove();
              layer.msg('已删除!',{icon:1,time:1000});
          });
      }
      function delAll (argument) {

        var data = tableCheck.getData();
  
        layer.confirm('确认要删除吗？'+data,function(index){
            //捉到所有被选中的，发异步进行删除
            layer.msg('删除成功', {icon: 1});
            $(".layui-form-checked").not('.header').parents('tr').remove();
        });
      }
    </script>
    
  </body>

</html>